package org.rency.spring.cloud.boot.jdbc.service;

import org.rency.spring.cloud.boot.jdbc.domain.MemberDomain;
import org.rency.spring.cloud.boot.jdbc.repository.MemberRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * $TODO
 *
 * @author: Created by user_rcy@163.com on 2016/08/17.
 * @version: V1.0.0
 * @since JDK 1.8
 */
@Service
public class MemberServiceImpl implements MemberService{

    @Autowired
    private MemberRepository memberRepository;

    @Override
    public MemberDomain add(MemberDomain member) {
        return memberRepository.save(member);
    }

    @Override
    public void remove(String memberId) {
        memberRepository.delete(memberId);
    }

    @Override
    public MemberDomain get(String memberId) {
        return memberRepository.getOne(memberId);
    }

    @Override
    public List<MemberDomain> loadAll() {
        return memberRepository.findAll();
    }
}
